package mytool

import (
	"log"
	"os"
	"path/filepath"

	"gopkg.in/ini.v1"
)

func Getconfig() *ini.File {
	ex, err := os.Executable()
	exPath := filepath.Dir(ex)
	cfg, err := ini.Load(exPath + "/config.ini")
	CheckErr(err)
	return cfg
}

func CheckErr(err error) {
	if err != nil {
		log.SetFlags(log.Lshortfile | log.Ldate | log.Ltime)
		log.Println(err.Error())
	}
}
